let driverBean={
  data(){
    return {
      //启用禁用提交表单
      openOrCloseFrom:{
        "uid": "",
        "disableEndTime": "",
        "driverStatus": ""
      },
      uploadUrl:this.url.baseUrl+this.url.api.PLOAD_IMG,
      uploadData:{
        imgType:"1"
      },
      headers:{
        Authorization:this.cookie.getCookie("x-token")
      },
      driverInfo:{
        carOwnerName:"",
        firstApplyDate:"",
        amount:"",
        drivingLicenseImgUrl:"",
        openId:"",
        mobile:"",
        carNum:"",
        idcardNo:"",
        driverLicenseImgUrl:"",
        carRegDate:"",
        areaName:"",
        wechatNickname:"",
        driverName:"",
        brandAndModel:"",
        persionImgUrl:"",
        insuranceImgUrl:""
      }
    }
  },
  methods:{
    appStatus(row){
      let val=row.isOnline;
      if(val==true||val=="true"){
        return "在线"
      }else {
        return "离线"
      }

    },
    status(row){
      let val=row.driverStatus;
      switch (val) {
        case 0:{
          return "未完善资料"
        }break;
        case 1:{
          return "提交待审核"
        }break;
        case 2:{
          return "正常"
        }break;
        case 3:{
          return "停用"
        }break;
        case 4:{
          return "禁用"
        }break;
        case 5:{
          return "审核不通过"
        }break;
      }
    },
    //启用
    able(uid,callback){
      this.openOrCloseFrom.uid=uid;
      this.openOrCloseFrom.driverStatus=2;
      this.updateStatus(callback)
    },
    //启用
    disable(uid,callback){
      this.openOrCloseFrom.uid=uid;
      this.openOrCloseFrom.driverStatus=4;
      this.updateStatus(callback)
    },
    //启用或者禁止
    updateStatus(callback){
      this.request.post({
        url:this.url.api.UPDATE_DRIVER_STATUS,
        data:this.openOrCloseFrom,
        success(){
          if(callback)callback();
        }
      })
    },
  }
}

export default driverBean
